package com.test;

import java.util.Collection;

public class ItemFactory {
	public static Item create(JsonKey key,Class c,Object o){
		if(c.isPrimitive()){
			return new DirectItem(key,o);
		}else if (o instanceof Collection){
			return new ListItem(key,o);
		}else if( c.isArray()){
			throw new UnsupportedOperationException();
		}else{
			String cls = c.getName();
			if(cls.startsWith("java")){
				return new DirectItem(key,o);
			}else{
				return new PojoItem(key,o);
			}
		}
	}
}
